package com.zhuanzhuan.hero.user.mq.consumer;

import com.bj58.youpin.common.utils.json.JsonUtils;
import com.zhuanzhuan.hero.user.mq.dto.BaseUserMsg;
import com.zhuanzhuan.hero.user.service.HeroCancelAccountService;
import com.zhuanzhuan.hunter.mq.consumer.anno.HunterConsumer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @ClassName CancelAccountConsumer
 * @Description
 * @Author hanjunjun
 * @Date 2024/7/12 16:09
 */
@Slf4j
@Component
public class CancelAccountConsumer {

    @Resource
    HeroCancelAccountService cancelAccountService;

    /**
     * 用户中台注销完成后的mq
     *
     * @param msgId
     * @param body
     * @return boolean
     * @author  hanjunjun
     * @date 2024/7/12
     **/
    @HunterConsumer(topic = "zzCancelAccount", group = "heroUserCancelAccount")
    public boolean heroUserCancelAccount(String msgId, BaseUserMsg body) {
        log.info("heroUserCancelAccount msgId={} body={}", msgId, JsonUtils.toJsonWithoutNull(body));
        return cancelAccountService.doCancelAccount(body.getUid());
    }
}
